package com.etc.rabbit;

import com.alibaba.fastjson.JSONObject;
import com.etc.entity.UserImage;
import com.etc.util.QiNiuUtil;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.Map;

@Component
@RabbitListener(queues = "uploadUserImage")
public class RabbitUserImage {

    @RabbitHandler
    public void receive(UserImage userImage) throws IOException {

            QiNiuUtil.fileUpLoad((userImage.getFile().getBytes()),"user/"+userImage.getUsername());


    }
}
